#include "ThreadPool.hpp"
#include <memory>
#include <ctime>

int main()
{
    EnableScreen();

    srand(time(nullptr));

    unique_ptr<ThreadPool<Task>> utp = make_unique<ThreadPool<Task>>(5);
    utp->InitThreadPool();
    utp->Start();

    int tasknum = 10;
    while(tasknum)
    {
        int a = rand() % 10 + 1;
        usleep(1000);
        int b = rand() % 20 + 1;
        Task t(a, b);
        LOG(INFO, "main thread push task: %s", t.DTostring().c_str());
        utp->Enqueue(t);
        sleep(1);
        tasknum--;
    }

    utp->Stop();
    utp->Wait();
    return 0;
}